﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class ZHCX_YJCXList : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!ProjectPrivate.GetQX("34"))
    {
      Server.Transfer("~\\blank.aspx");
    }
    if (!Page.IsPostBack)
    {
      //date1.Text = CommonUse.GetYC();
      //date2.Text = CommonUse.GetYM();
    }
    BindGrid();
  }

  protected void BindGrid()
  {
    DataSet ds = GetYEDS();
    ASPxGridView1.DataSource = ds;
    ASPxGridView1.DataBind();
  }
  protected void btnQuery_Click(object sender, EventArgs e)
  {

  }

  protected void btnExport_Click(object sender, EventArgs e)
  {
    this.ASPxGridViewExporter1.WriteXlsToResponse();
  }
  protected DataSet GetYEDS()
  {
    string sql = @"select ROW_NUMBER() OVER (ORDER BY a.khid desc) AS xh,a.KHID,a.ye LJJE,b.* from 
(select a.KHID,SUM(a.YJ) ye from SJLR_YJLR a group by a.KHID) a,
(select * from JCXX_KHXX) b 
where a.khid=b.khid";
    DataSet ds = DbHelperSQL.Query(sql);
    return ds;
  }
}